package com.hefu.virtuallife.ui.map.history;

import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;

import com.fei.root.common.Display;
import com.fei.root.recater.adapter.RefloadAdapter;
import com.fei.root.recater.decoration.DividerDecoration;
import com.fei.root.recater.view.RefloadRecyclerView;
import com.fei.root.recater.viewholder.CommonHolder;
import com.hefu.virtuallife.R;
import com.hefu.virtuallife.base.BaseFragment;
import com.hefu.virtuallife.customview.LoadingView;
import com.hefu.virtuallife.customview.RefreshView;

import java.util.ArrayList;

import butterknife.BindView;

public class TaxiHistoryListFragment extends BaseFragment {


    @BindView(R.id.list)
    RefloadRecyclerView recyclerView;

    public static TaxiHistoryListFragment newInstance(String content) {
        TaxiHistoryListFragment fragment = new TaxiHistoryListFragment();
        Bundle bundle = new Bundle();
        bundle.putString("data", content);
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    protected int setLayoutId() {
        return R.layout.fragment_taxi_history_list;
    }

    @Override
    protected void init(Bundle savedInstanceState, View view) {
        ArrayList<String> list = new ArrayList<>();
        list.add("1");
        list.add("1");
        list.add("1");
        list.add("1");
        list.add("1");
        list.add("1");
        list.add("1");
        list.add("1");
        list.add("1");
        list.add("1");
        recyclerView.setLayoutManager(new LinearLayoutManager(getBaseActivity(), LinearLayoutManager.VERTICAL, false));
        recyclerView.addItemDecoration(new DividerDecoration(ContextCompat.getColor(getBaseActivity(), R.color.transparent), (int) Display.dp2px(10)));
        RefloadAdapter<String> commonAdapter = new RefloadAdapter<String>(list, R.layout.layout_item_taxi_his) {
            @Override
            protected void convert(CommonHolder holder, String s, int position) {
            }
        };
        commonAdapter.setRefreshHeader(new RefreshView(getBaseActivity()));
        commonAdapter.setLoadMoreFooter(new LoadingView(getBaseActivity()));
        commonAdapter.setEnablePullLoadMore(true);
        commonAdapter.setEnablePullRefreshing(true);
        recyclerView.setAdapter(commonAdapter);
    }


}
